//
//  YYEPaymentDetailTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2018/1/5.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYEPaymentDetailTableViewCell.h"

@interface YYEPaymentDetailTableViewCell ()

@property (nonatomic,strong) UILabel *nameLabel;
@property (nonatomic,strong) UILabel *moneyLabel;
@property (nonatomic,strong) UILabel *timeLabel;
@property (nonatomic,strong) UIView *lineView;

@end

@implementation YYEPaymentDetailTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = GeneralBackColor;
        
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.textColor = [UIColor blackColor];
        self.nameLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.nameLabel];
        
        self.timeLabel = [[UILabel alloc]init];
        self.timeLabel.textColor  = GeneralGrayColor;
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.timeLabel];
        
        self.moneyLabel = [[UILabel alloc]init];
        self.moneyLabel.font = [UIFont systemFontOfSize:18];
        self.moneyLabel.textColor = GeneralBlueColor;
        [self.contentView addSubview:self.moneyLabel];
        
        self.lineView = [[UIView alloc]init];
        self.lineView.backgroundColor = GeneralLightYellow;
        [self.contentView addSubview:self.lineView];
        
        self.nameLabel.text = @"购买课程";
        self.timeLabel.text = @"2017-10-23 17:46";
        self.moneyLabel.text = @"-100.00元";
        
    }
    return self;
    
}

- (void)setModel:(PayModel *)model
{
    _model = model;
    
    self.nameLabel.text = model.subject;
    self.timeLabel.text = model.created_at;
    self.moneyLabel.text = model.money;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(WSCALE * 30);
        make.top.equalTo(self.contentView.top).offset(12);
    }];
    
    [self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(WSCALE * 30);
        make.bottom.equalTo(self.contentView.bottom).offset(-7);
    }];
    
    [self.moneyLabel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.right).offset(-WSCALE * 15);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(20);
        make.right.equalTo(self.contentView.right).offset(-20);
        make.bottom.equalTo(self.contentView.bottom);
        make.height.equalTo(0.5);
    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
